package com.xnyzc.lhy.order.service.oss;

import com.xnyzc.lhy.common.entity.HeadBash64;
import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.order.service.oss.hystrix.IOaOssFileClientServiceHystrix;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;


/**
 * Feign 资源服务
 * 获取文件地址
 * zhuyubin
 */
@Service
@FeignClient(value = "${feign.applicationName.resource}", fallback = IOaOssFileClientServiceHystrix.class)
public interface IOaOssFileClientService {

    /**
     * 获取文件地址
     *
     * @param fileId 文件id
     * @return
     */
    @GetMapping(value = "oa/cos/getFileUrl")
    Rv getFileUrl(@ApiParam(name = "fileId", value = "文件ID") @RequestParam(value = "fileId") Long fileId);

    /**
     * 单文件上传
     *
     * @return
     */
    @ApiOperation(value = "单文件上传", notes = "单文件上传")
    @PostMapping(value = "oa/cos/uploadHeadFile")
    Rv uploadFile(@RequestBody HeadBash64 headBash64);

}
